<?php /*a:1:{s:74:"F:\phpEnv\www\www.ainiu.com\xnadmin_v2.1.0\app\admin\view\login\index.html";i:1726826608;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>登入 - <?php echo xn_cfg('base.sys_name'); ?></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="author" content="小牛Admin通用后台，xnadmin.cn">
    <script src="/static/admin/js/jquery-2.0.0.min.js"></script>
    <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin/style/login.css?v2.1.0" media="all">
</head>
<body>
<div id="particles-js">
    <canvas class="particles-js-canvas-el" width="1920" height="1080" style="width: 100%; height: 100%;"></canvas>
</div>

<div class="login-box">
    <div class="top">
        <?php echo xn_cfg('base.sys_name'); ?>
        <span class="bg bg1"></span>
        <span class="bg bg2"></span>
    </div>

    <form class="layui-form">
        <div class="layui-row layui-col-space16">
            <div class="layui-col-md12">
                <div class="layui-input-wrap">
                    <div class="layui-input-prefix">
                        <i class="layui-icon layui-icon-username"></i>
                    </div>
                    <input type="text" placeholder="用户名" name="username" lay-verify="required" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-col-md12">
                <div class="layui-input-wrap">
                    <div class="layui-input-prefix">
                        <i class="layui-icon layui-icon-password"></i>
                    </div>
                    <input type="password" placeholder="密码" name="password" lay-verify="required" autocomplete="off" class="layui-input">
                </div>
            </div>
            <?php if(xn_cfg('base.login_vercode') == 1): ?>
            <div class="layui-col-md12">
                <div class="layui-row">
                    <div class="layui-col-xs7">
                        <div class="layui-input-wrap">
                            <div class="layui-input-prefix">
                                <i class="layui-icon layui-icon-vercode"></i>
                            </div>
                            <input type="text" placeholder="验证码" name="vercode" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-col-xs5">
                        <div style="margin-left: 10px;">
                            <img src="<?php echo url('login/verify'); ?>" class="codeimg" id="vercode">
                        </div>
                    </div>
                </div>
            </div>
            <?php endif; ?>
            <div class="layui-col-md12">
                <button class="layui-btn layui-btn-fluid" lay-submit="" lay-filter="login" >立即登录</button>
            </div>
        </div>
    </form>
</div>
<script src="/static/admin/js/particles.js"></script>
<script src="/static/admin/layui/layui.js"></script>
<script src="/static/admin/js/admin.js"></script>
<script>
    layui.use(['layer', 'jquery'], function(){
        var $ = layui.$;

        $('.layui-form').submit(function(){
            var data = $(this).serialize();
            $.ajax({
                type: "post",
                url:"<?php echo url('login/index'); ?>",
                data:data,
                dataType:"json",
                success:function(data){
                    if( data.code == 1 ) {
                        layer.msg('登入成功', {
                            offset: '15px'
                            ,icon: 1
                            ,time: 1000
                        }, function(){
                            location.href = "<?php echo url('index/index'); ?>"; //后台主页
                        });
                    } else {
                        $('#vercode').attr('src', "<?php echo url('login/verify'); ?>?" + Date.parse(new Date()))
                        layer.msg(data.msg);
                    }
                },
                error:function(data){
                    $('#vercode').attr('src', "<?php echo url('login/verify'); ?>?" + Date.parse(new Date()))
                    alert(data);
                }
            });
            return false;
        });

        $('#vercode').click(function () {
            $(this).attr('src', "<?php echo url('login/verify'); ?>?" + Date.parse(new Date()))
        })
    });
</script>
</body>
</html>